# Start dev container
up.dev:
	docker compose -f docker.dev-compose.yml up

# Start detached dev container
upd.dev:
	docker compose -f docker.dev-compose.yml up -d

# Down dev container
down.dev:
	docker compose -f docker.dev-compose.yml down

# Down dev container with all its volumes
downv.dev:
	docker compose -f docker.dev-compose.yml down -v

# Recreate dev container
recreate.dev:
	docker compose -f docker.dev-compose.yml up --build --force-recreate --remove-orphans

# Start prod container
up.prod:
	docker compose -f docker.prod-compose.yml up

# Start detached prod container
upd.prod:
	docker compose -f docker.prod-compose.yml up -d

# Down prod container
down.prod:
	docker compose -f docker.prod-compose.yml down

# Down prod container with all its volumes
downv.prod:
	docker compose -f docker.prod-compose.yml down -v

# Recreate prod container
recreate.prod:
	docker compose -f docker.prod-compose.yml up --build --force-recreate --remove-orphans

# Build base image for PHP8.3
build.base-8.3:
	docker build ./docker/base/runtimes/8.3 \
		-f ./docker/base/runtimes/8.3/Dockerfile.base \
		--build-arg USER=frankenstein \
		--build-arg GROUP=frankenstein \
		-t czernika/laravel-frankenphp-8.3

# Build production ready image for PHP8.3
build.prod-8.3:
	docker build . \
		-f ./docker/base/runtimes/8.3/Dockerfile.prod \
		--build-arg USER=frankenstein \
		--build-arg GROUP=frankenstein \
		-t czernika/laravel-frankenphp-8.3-prod

# Copy root certificate from Caddy
certificate.cp:
	docker compose -f docker.dev-compose.yml cp \
		frankenstein.test:/app/config/caddy/pki/authorities/local/root.crt \
		./infrastructure/certs/root.crt
